<template>
  <view class="detail-page">
    <view class="list-wrap" v-if="integralDetail.length > 0">
      <view
        class="list-item"
        v-for="(item, index) in integralDetail"
        :key="index"
      >
        <view>
          <view class="item-title">{{ item.businessType }}</view>
          <view class="item-time">{{ item.createTime.slice(0, 16) }}</view>
        </view>
        <view>
          <view class="item-pirce"
            >{{
              item.addOrSubtract == 1
                ? "+"
                : item.addOrSubtract == 2
                ? "-"
                : ""
            }}{{ item.variation }}</view
          >
        </view>
      </view>
    </view>
    <Empty v-else />
  </view>
</template>

<script>
import mineApi from "@/api/mine";
export default {
  name: "integralDetail",
  data() {
    return {
      integralDetail: [],
    };
  },
  onLoad(options) {
    this.getIntegralDetail();
  },
  methods: {
    getIntegralDetail() {
      mineApi.getIntegralDetail().then((res) => {
        if (res.code == 200) {
          this.integralDetail = res.rows;
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.detail-page {
  width: 100vw;
  height: 100vh;
  overflow-y: auto;
  background: #fff;

  .list-wrap {
    margin-top: 10rpx;

    .list-item {
      margin: 30rpx 30rpx 0rpx 30rpx;
      padding-bottom: 30rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #efefef;

      .item-title {
        color: #000000;
        font-family: "PingFang SC";
        font-size: 26rpx;
        font-style: normal;
        font-weight: 500;
        line-height: normal;
        opacity: 0.9;
      }

      .item-time {
        color: #000000;
        font-family: "PingFang SC";
        font-size: 20rpx;
        font-style: normal;
        font-weight: 400;
        line-height: normal;
        opacity: 0.5;
        margin-top: 8rpx;
      }

      .item-pirce {
        color: #000000;
        text-align: right;
        font-family: "PingFang SC";
        font-size: 32rpx;
        font-style: normal;
        font-weight: 500;
        line-height: normal;
        opacity: 0.9;
      }
    }
  }
}
</style>
